package com.sayice.design.lab5_1;

import com.sayice.design.util.XmlParse;
import org.xml.sax.SAXException;

import java.io.IOException;

/**
 * @author shubing
 */
public class Main {
    public static void main(String[] args) throws IOException, SAXException {
        ConcreteForm form = new ConcreteForm();
        form.setContent("报表内容……");
        XmlParse xmlParse = new XmlParse("decoratorConfig.xml");
        DecoratedForm decoratedForm1 = (DecoratedForm) xmlParse.objectOfTag("decorator1");
        decoratedForm1.setForm(form);
        System.out.println(decoratedForm1.getContent());
        System.out.println();
        // 多重装饰
        DecoratedForm decoratedForm2 = (DecoratedForm) xmlParse.objectOfTag("decorator2");
        decoratedForm2.setForm(decoratedForm1);
        System.out.println(decoratedForm2.getContent());
    }
}
